import _axios, { get } from '@/lin/plugin/axios'

class Warehousing {
  // 入库单列表、查询
  async getWarehousingList(data) {
    const res = await get('v1/inboundOrder/page', data)
    return res
  }

  // 入库单管理、新增
  async add_Warehousing(data) {
    return _axios({
      method: 'post',
      url: 'v1/inboundOrder/createInboundOrder',
      data,
    })
  }

  // 入库单管理、修改
  async edit_Warehousing(data) {
    return _axios({
      method: 'post',
      url: 'v1/inboundOrder/updateInboundOrder',
      data,
    })
  }

  // 入库单管理、软删除
  async soft_delete_Warehousing(data) {
    return _axios({
      method: 'post',
      url: 'v1/inboundOrder/draft',
      data,
    })
  }

  // 入库单管理、真删除
  async reallyDelete_Warehousing(data) {
    return _axios({
      method: 'post',
      url: 'v1/inboundOrder/deleteInboundOrder',
      data,
    })
  }

  // 仓库
  async getWarehouseList() {
    const res = await get('v1/userWare/2')
    return res
  }

  // 根据id获取入库单信息
  async getWarehouseDetail(id) {
    const res = await get(`v1/inboundOrder/receiving/${id}`)
    return res
  }

  // 获取产品
  async getProductHanlder() {
    const res = await get('v1/product/findAllByAudit')
    return res
  }

  // 入库单管理、批量审核
  async toExamine_Warehousing(data) {
    return _axios({
      method: 'post',
      url: 'v1/inboundOrder/audit',
      data,
    })
  }
}

export default new Warehousing()
